<?php
/**
 * User: yuanxuncheng
 * File: User.php
 * Date: 2016/12/17
 * Time: 23:13
 */

namespace app\api\controller;

use app\api\model\page\user\GetUserCommunityLevel;
use app\api\model\page\user\GetUserInfo;
use app\api\model\page\user\UserIndex;
use app\api\model\page\user\AddUserAccount;
use app\api\model\page\user\GetRecommendRank;
use app\api\model\page\user\GetUserDetail;
use app\api\model\page\user\SigninIndex;
use app\api\model\page\user\GetAllUser;
use app\api\model\page\user\Register as RegisterModel;
use app\api\model\page\user\IsRegisted as IsRegistedModel;
use app\api\model\page\user\Login as LoginModel;
use app\api\model\page\user\Logout as LogoutModel;
use app\api\model\page\user\Forgot as ForgotModel;
use app\api\model\page\user\GetVerifyCode as GetVerifyCodeModel;
use app\api\model\page\user\Signin;
use app\api\model\page\user\Update as UpdateModel;
use app\api\model\page\user\GetUserAccount as GetUserAccountModel;
use app\api\model\page\user\GetUpRank as GetUpRankModel;
use app\api\model\page\user\GetConsumerRank as GetConsumerRankModel;
use app\api\model\page\user\UpdateUserLabel;
use app\api\model\page\user\UserSilence;
use app\api\model\page\user\GetAuthConfig;
use think\Request;


class User
{

    private $registerModel;
    private $isRegistedModel;
    private $loginModel;
    private $logoutModel;
    private $forgotModel;
    private $getVerifyCodeModel;
    private $updateModel;
    private $getUserAccountModel;
    private $getConsumerRankModel;
    private $getUpRankModel;
    private $getAuthConfig;


    public function __construct()
    {
        $this->param = Request::instance()->param();
    }

    /**
     * @desc 注册
     * @return array
     */
    public function register()
    {
        $this->registerModel = new RegisterModel();
        return $this->registerModel->excute($this->param);
    }

    /**
     * @desc 是否已经注册
     * @return array
     */
    public function isRegisted()
    {
        $this->isRegistedModel = new IsRegistedModel();
        return $this->isRegistedModel->excute($this->param);
    }

    /**
     * @desc 登录
     * @return array
     */
    public function login()
    {
        $this->loginModel = new LoginModel();
        return $this->loginModel->excute($this->param);
    }

    /**
     * @desc 退出系统
     * @return array
     */
    public function logout()
    {
        $this->logoutModel = new LogoutModel();
        return $this->logoutModel->excute($this->param);
    }

    /**
     * @desc 忘记密码
     * @return array
     */
    public function forgot()
    {
        $this->forgotModel = new ForgotModel();
        return $this->forgotModel->excute($this->param);
    }

    /**
     * @desc 发送短信并验证手机号码
     * @return array
     */
    public function getVerifyCode()
    {
        $this->getVerifyCodeModel = new GetVerifyCodeModel();
        return $this->getVerifyCodeModel->excute($this->param);
    }

    /**
     * @desc 更新用户信息
     * @return array
     */
    public function update()
    {
        $this->updateModel = new UpdateModel();
        return $this->updateModel->excute($this->param);
    }

    /**
     * @desc 获取用户信息
     * @return array
     */
    public function getUserAccount()
    {
        $this->getUserAccountModel = new GetUserAccountModel();
        return $this->getUserAccountModel->excute($this->param);
    }


    /**
     * 签到
     *
     * @return array
     */
    public function signin()
    {
        $obj = new Signin();
        return $obj->excute($this->param);
    }

    /**
     * 签到首页
     *
     * @return array
     */
    public function signinIndex()
    {
        $obj = new SigninIndex();
        return $obj->excute($this->param);
    }

    /**
     * 供后台管理使用
     */
    public function getUserDetail()
    {
        $obj = new GetUserDetail();
        return $obj->excute($this->param);
    }

    /**
     * 供后台管理使用
     */
    public function addUserAccount()
    {
        $obj = new AddUserAccount();
        return $obj->excute($this->param);
    }

    /**
     * 消费榜
     *
     * @return array
     */
    public function getConsumerRank()
    {
        $obj = new GetConsumerRankModel();
        return $obj->excute($this->param);
    }

    /**
     * 人气榜
     *
     * @return array
     */
    public function getUpRank()
    {
        $obj = new GetUpRankModel();
        return $obj->excute($this->param);
    }

    /**
     * 推举榜
     *
     * @return array
     */
    public function getRecommendRank()
    {
        $obj = new GetRecommendRank();
        return $obj->excute($this->param);
    }

    /**
     * 修改用户标签
     *
     * @return array
     */
    public function updateUserLabel()
    {
        $obj = new UpdateUserLabel();
        return $obj->excute($this->param);
    }

    /**
     * 用户主页
     *
     * @return array
     */
    public function userIndex()
    {
        $obj = new UserIndex();
        return $obj->excute($this->param);
    }

    public function userInfo()
    {
        $obj = new GetUserInfo();
        return $obj->excute($this->param);
    }

    public function userSilence()
    {
        $obj = new UserSilence();
        return $obj->excute($this->param);
    }

    /**
     * 社区等级页面接口数据
     *
     * @return array
     */
    public function userCommunityLevel()
    {
        $obj = new GetUserCommunityLevel();
        return $obj->excute($this->param);
    }

    public function getAuthConfig()
    {
        $obj = new GetAuthConfig();
        return $obj->excute($this->param);
    }

}
